%%work in progress
screenNum=0;
width = 640;
height = 480;

res=[width height];
clrdepth=32;
[wPtr, rect]=Screen('OpenWindow', screenNum, 0, [0 0 res(1) res(2)], clrdepth);
Screen(wPtr,'BlendFunction',GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); %:O

white=WhiteIndex(wPtr);
gray=GrayIndex(wPtr);
Screen('FillRect', wPtr, white);

refresh = Screen('GetFlipInterval', wPtr);
vbl = Screen('Flip', wPtr);

%load image


X = imread('/home/jenriquez/Desktop/robotInodor.jpg');
tIndex = Screen('MakeTexture', wPtr, X);
Screen('DrawTexture', wPtr, tIndex);

%noise = 255*rand(100,100)
%ti = Screen('MakeTexture',wPtr, noise);
%Screen('DrawTexture',wPtr, ti);

% random x and y coordinates for the circles
x = unidrnd(500,1,25);
y = unidrnd(500,1,25);


colors = [200 10 10];
%rects = [150 150 200 200 ; 150 150 200 200]
rects = [x; y ; x + 20 ; y + 20];

Screen('FillOval',wPtr,colors, rects);


Screen('Flip', wPtr);

WaitSecs(2);

%Screen('DrawText', wPtr, 'Termin�', res(1)/2 - 200, res(2)/2,[0 0 0 128]);
Screen('Flip', wPtr);

%KbStrokeWait();




%toffset = Screen('Flip', wPtr, vbl + (6 - 0.5) * refresh);



Screen('CloseAll');
ShowCursor;


